namespace Ds.DataBase.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class UpdateDeFenBiao1 : DbMigration
    {
        public override void Up()
        {
            DropForeignKey("dbo.KaoHeDeFenHuiZongs", "KaoHeDeFenHuiZong_dfid", "dbo.KaoHeDeFenHuiZongs");
            DropIndex("dbo.KaoHeDeFenHuiZongs", new[] { "KaoHeDeFenHuiZong_dfid" });
            CreateTable(
                "dbo.KaoHeChengJiQueRens",
                c => new
                    {
                        qrid = c.Int(nullable: false, identity: true),
                        dfid = c.Int(nullable: false),
                        username = c.String(),
                        qrlx = c.Int(nullable: false),
                        bz = c.String(),
                    })
                .PrimaryKey(t => t.qrid)
                .ForeignKey("dbo.KaoHeDeFenHuiZongs", t => t.dfid, cascadeDelete: true)
                .Index(t => t.dfid);
            
            AlterColumn("dbo.MyKaoHeBiao_fujiaxiang", "xmfz", c => c.Decimal(nullable: false, precision: 18, scale: 2));
            DropColumn("dbo.KaoHeDeFenHuiZongs", "KaoHeDeFenHuiZong_dfid");
        }
        
        public override void Down()
        {
            AddColumn("dbo.KaoHeDeFenHuiZongs", "KaoHeDeFenHuiZong_dfid", c => c.Int());
            DropForeignKey("dbo.KaoHeChengJiQueRens", "dfid", "dbo.KaoHeDeFenHuiZongs");
            DropIndex("dbo.KaoHeChengJiQueRens", new[] { "dfid" });
            AlterColumn("dbo.MyKaoHeBiao_fujiaxiang", "xmfz", c => c.String());
            DropTable("dbo.KaoHeChengJiQueRens");
            CreateIndex("dbo.KaoHeDeFenHuiZongs", "KaoHeDeFenHuiZong_dfid");
            AddForeignKey("dbo.KaoHeDeFenHuiZongs", "KaoHeDeFenHuiZong_dfid", "dbo.KaoHeDeFenHuiZongs", "dfid");
        }
    }
}
